package com.ysd.lis.service.lab.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ysd.common.Result;
import com.ysd.lis.entity.lab.WlConfigRulessetting;
import com.ysd.lis.mapper.lab.WlConfigRulessettingMapper;
import com.ysd.lis.request.wl.WlConfigSettingParam;
import com.ysd.lis.service.lab.WlConfigRulessettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 启动对象配置 服务实现类
 * </p>
 *
 * @author WangHao
 * @since 2024-01-18
 */
@Service
public class WlConfigRulessettingServiceImpl extends ServiceImpl<WlConfigRulessettingMapper, WlConfigRulessetting> implements WlConfigRulessettingService {

    @Autowired
    private WlConfigRulessettingMapper configRulessettingMapper;


    @Override
    public Result findRulessettingByConfigId(WlConfigSettingParam wlConfigParam) {
        if (StringUtils.isBlank(wlConfigParam.getWLConfigId())) {
            return Result.fail("信息配置id不能为空");
        }
        LambdaQueryWrapper<WlConfigRulessetting> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(WlConfigRulessetting::getDelFlag, 0);
        lambdaQueryWrapper.eq(WlConfigRulessetting::getWlConfigId, wlConfigParam.getWLConfigId());
        List<WlConfigRulessetting> configRulessettings = configRulessettingMapper.selectList(lambdaQueryWrapper);
        return Result.succ(1, "查询成功", configRulessettings);
    }
}
